package com.bingo.demo.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.util.ClassUtils;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class UploadConfig implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //映射图片保存地址
        String realPath = System.getProperty("user.dir");
        //registry.addResourceHandler("/img/**").addResourceLocations("file:"+realPath+"\\src\\main\\resources\\static\\img");
        registry.addResourceHandler("/img/**").addResourceLocations("file:\\Users\\封云小斌\\IdeaProjects\\myBlog\\src\\main\\resources\\static\\img\\");
    }
}